<template>
	<view>
		<normal-paging ref="listItem" v-bind="normalPagingConfig">
			<template #top>
				<custom-nav v-bind="navConfig" />
			</template>
			<template #dataList="{item}">
				<Item :info="item" @handlePopup="e => {
					data = e
					$refs.xfmx.open()
				}" @handleSetFans="handleSetFans" />
			</template>
		</normal-paging>
		<xfmx-popup ref="xfmx" :data="data" />
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex";
	import navConfig from './config/navConfig.js'
	import normalPagingConfig from './config/normalPagingConfig.js'
	import Item from './cps/item.vue'
	import xfmxPopup from '@/components/xfmx-popup/xfmx-popup.vue'
	import {
		setFans
	} from '@/service/index.js'

	export default {
		components: {
			Item,
			xfmxPopup
		},
		computed: {
			...mapState({
				userInfo: state => state.login.userInfo
			}),
		},
		data() {
			return {
				navConfig,
				normalPagingConfig,
				data: {}
			};
		},
		onLoad(options) {
			
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: `${this.userInfo.wechat_info.title}`
			})
		},
		methods: {
			async handleSetFans(params) {
				const result = await setFans(params)
				this.$refs.listItem.refresh()
			}
		}
	}
</script>

<style lang="scss">

</style>